﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Windows.Forms;
using Silvermoon.WinControls;
using OutlookHub.Pages;
using OutlookHub.Models;
using System.Diagnostics;
using Silvermoon.Navigation;
using OutlookHub.Utils;
using Silvermoon.Controls;
using System.Threading;

namespace OutlookHub
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [MTAThread]
        static void Main()
        {
            SetWorkerThreads();
            PageTransitions.DefineTransitions();
            SMApplication.Run<OutlookPanorama>("Outlook");
            DisposeContexts();
        }

        private static void DisposeContexts()
        {
            Thread.Sleep(5);
            EMailContext.Close();
            OutlookContext.Close();
        }

        private static void SetWorkerThreads()
        {
            int workerThreads, completionPortThreads;
            ThreadPool.GetMaxThreads(out workerThreads, out completionPortThreads);
            ThreadPool.SetMaxThreads(8, completionPortThreads);
        }
    }
}